<template>
	<!-- 地址簿列表 -->
	<view class="" style="background: #F5F7F9;">
		<tohome />
		<navbar :navigationBarStyle="navigationBarStyle"></navbar>
		<view class="screen" style="min-height: 100vh;" :style="'padding-top:' + vuex_phoneLayout.screenPaddingTop + 'px'">
			<view class="couponList">
				<view class="couponList_item" v-for="(item, index) in radiolist1" :key="index">
					<view class="couponList_item_content">
						<view class="couponList_item_left default-bgLinear">
							<view class="couponList_item_text1">
								¥<text class="couponList_item_title">1.5</text>
							</view>
							<view class="couponList_item_text2">
								无使用门槛
							</view>
						</view>
						<view class="couponList_item_right">
							<view class="">
								<view class="couponList_item_text1">
									优惠券名称
								</view>
								<view class="couponList_item_text2">
									有效期：2017.03.10-2017.12.30
								</view>
							</view>
							<view>
							 <u-radio-group
									v-model="radiovalue1"
									placement="column"
									@change="groupChange"
								>
									<u-radio
										:customStyle="{marginBottom: '8px'}"
										:name="item.name"
										@change="radioChange"
									>
									</u-radio>
								</u-radio-group>
							</view>
							
						</view>
					</view>
				</view>
			</view>
			<view class="screen-bottomFill" style="opacity: 1;" :style="'height:' + vuex_phoneLayout.ipxbottom + 'px;'">
				<!-- 用来填充导航 和 底部的多余 -->
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				navigationBarStyle: {
					background: 'white',
					color: 'black',
					iconText: '选择优惠券/抵用券' //导航栏文字
				},
				dataList:[],
				radiolist1: [
					{
						name: '苹果',
						disabled: false
					},
					{
						name: '香蕉',
						disabled: false
					},
				],
				radiovalue1: '苹果'
			};
		},
		onLoad(option) {
		},
		onShow() {
			this.getData()
		},
		watch:{
		},
		methods: {
			groupChange(n) {
				console.log('groupChange', n);
			},
			radioChange(n) {
				console.log('radioChange', n);
			},
			search(e){
				console.log(e)
			},
			selectOk(e, i){
				console.log('selectOk')
				var _this = this;
				let pages = getCurrentPages(); //获取当前页面js里面的pages里的所有信息。
				let prevPage = pages[pages.length - 2]; 
				prevPage.myAddress = this.dataList[i];
				uni.navigateBack();
			},
			delHandle(e,i){
				let that = this
				uni.showModal({
					title: '提示',
					content: '是否确认删除',
					success: function (res) {
						console.log(res)
						if(res.confirm) {
							// that
							let pa = {
								id:that.dataList[i].id
							}
							that.$u.api.deleteAddress(pa).then(res =>{
								that.$u.toast('删除成功');
								that.getData()
							})
						}
					}
				});
			},
			getData(){
				let pa = {
					"addrId": this.vuex_myAddress.id,
					"kg": this.vuex_kg,
					"serviceType": this.vuex_sendOrGet == 'get' ? 1:0,
					"siteId": this.vuex_site.id,
					"tip": 0
				}
				this.$u.api.getOrderCouponList(pa).then(res => {
					console.log(res)
					if (res.code == '200') {
						this.dataList = res.data
					} else {
						this.$u.toast(res.message);
					}
				});
			}
			
		}
	};
</script>
<style lang="scss">
	@import 'index.scss';
	.couponList {
		padding: 42rpx 30rpx ;
		
		min-height: 100vh;
	}
	.couponList_item {
		border-radius: 20rpx;
		overflow: hidden;
		position: relative;
		background: #FFFFFF;
		margin-bottom: 40rpx;
	}
	.couponList_item_content {
		display: flex;
	}
	.couponList_item_text1 {
		font-size: 34rpx;
		font-weight: 800;
		line-height: 1;
	}
	.couponList_item_text2 {
		font-size: 24rpx;
		line-height: 1;
		margin-top: 10rpx;
	}
	.couponList_item_title {
		font-size: 48rpx;
		line-height: 1;
	}
	.couponList_item_left {
		height: 160rpx;
		flex: 0 0 26%;
		color: #FFFFFF;
		display: flex;
		align-items: flex-start;
		justify-content: center;
		flex-direction: column;
		padding-left: 30rpx;
	}
	.couponList_item_right {
		padding: 0 0rpx 0 24rpx;
		flex: 1;
		height: 160rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		.couponList_item_text1 {
			color: #282828;
		}
		.couponList_item_text2 {
			color: #B5B5B5;
		}
	}
	.couponList_item_bottom {
		padding: 18rpx 23rpx 23rpx;
		font-size: 24rpx;
		color: #B5B5B5;
		line-height: 36rpx;
		word-break: break-word;
	}
</style>
